<?php

	class IndexModel extends Model{
		public function indexAction(){
			$num = isset($_GET['num'])?$_GET['num']:0;
			$type =  isset($_GET['type'])?$_GET['type']:'';
			if($type == 0){
				$sql = "select a.id,a.activityName,a.activityContent,a.activityType,a.activityDate,a.img,a.activityLimit,a.activityNum,a.num,u.username,u.avatar from `activity` a left join user u on a.uid = u.id where a.status = 1 limit $num,3";
			
			}else{
				$sql = "select a.id,a.activityName,a.activityContent,a.activityType,a.activityDate,a.img,a.activityLimit,a.activityNum,a.num,u.username,u.avatar from `activity` a left join user u on a.uid = u.id where a.status = 1 and a.activityType = $type limit $num,3";
			}
			$data = $this->link->selectDB($sql);
			echo json_encode($data);
		}
		public function classifyAction(){
			$type = isset($_GET['type'])?$_GET['type']:'';
			echo json_encode($type);
		}
	}